/*
 * CodeListIterator.h
 *
 *  Created on: 4 May 2010
 *      Author: Savramis Sartios
 */

#ifndef CODELISTITERATOR_H_
#define CODELISTITERATOR_H_
#include "../../../Domain/CodeList/List/ICodeList.h"
#include "ICodeIterator.h"

class CodeListIterator : public ICodeIterator {
public:
	CodeListIterator();
	CodeListIterator(const ICodeList *list);
	virtual ~CodeListIterator();

	/**
	 * Set the current pointer to the beginning
	 */
	virtual void	first();

	/**
	 * Increase the current pointer +1
	 */
	virtual void	next();

	/**
	 * Checks if the current pointer points inside the list
	 * \return true if pointer points inside the list
	 */
	virtual bool isDone()const;

	/**
	 * Returns the next course code of the list
	 * \return code the course code
	 * \throw  OutOfBound
	 */
	virtual string *	getCurrent()const;

	/**
	 * Set the list
	 * \param	code list
	 * \throw	NullPointer
	 */
	virtual bool 	setList(const ICodeList *list);

protected:
	bool	setCurrent(const int current);
	bool	increaseCurrent();

private:
	int		  	current_;
	ICodeList * list_;
};

#endif /* CODELISTITERATOR_H_ */
